<?php
my_component_load('testing' , false);
my_component_load('paging' , false); 
my_component_load('data_setting', false);
my_component_load('spd_biaya_golongan_jabatan' );
$task = isset($_GET['task']) ? $_GET['task'] : ""; 
$id = isset( $_GET['id'] ) ? $_GET['id']:  0;
$modulname = "Admin _BN_ Konfigurasi Data _BN_ By. Gol. Jabatan (STPD)";

if($_SERVER['REQUEST_METHOD'] == "POST" ):
   
	switch($task){
		case   "create" :
			$validatepost = form_biaya_validate($id);
			if($validatepost){
				$errors = message_multi_error($validatepost);
				$content = $errors;
				$content .= form_biaya_create($id);
				generate_my_web($content,"","plain.php");
				exit; 
			}else{
				form_biaya_submit($id);
				$content =  "Updated";
				generate_my_web($content,"","plain.php");
				exit;
			}
			break;

	}

else: 	
	if($task == "edit"){
		$title= ($id > '0' ) ?  "Perubahan Data" : "Tambah Data";
		facebox_page('index.php?com='.$_GET['com'].'&task=create&id='.$id , $title , 240	); 
		exit;
	}elseif($task == "create"){ 
		$content  = form_biaya_create($id);
		generate_my_web($content,"","plain.php");
		exit; 
	}elseif($task == 'delete'){ // DELETE ITEM	
		remove_biaya($id);
		my_direct('index.php?com=spd_biaya_golongan_jabatan');
	}else{
		$pagename = "Biaya Golongan Jabatan (STPD)";
		load_facebox_script();
		$view =  list_biaya_golongan_jabatan(); 
		$href = 'index.php?com=spd_biaya_golongan_jabatan&task=edit&id=0' ;
		$content = spliter_browser( $view , $pagename ,$href);
		generate_my_web($content, $modulname );
	}
endif; 
?>